package conson.tech.manage.facade;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @ClassName WebMvcConfigurer
 * @Description
 * @Author HXL
 * @Date 2019-10-08
 * @Version 1.0
 */
@Configuration
@EnableSwagger2
public class WebMvcConfigurer extends WebMvcConfigurationSupport {
    /**
     * 访问静态资源
     * */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
                registry.addResourceHandler("swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");
                registry.addResourceHandler("/webjars/**")
                 .addResourceLocations("classpath:/META-INF/resources/webjars/");
                registry.addResourceHandler("/swagger/**")
                        .addResourceLocations("classpath:/static/swagger/");
                super.addResourceHandlers(registry);
    }
    /**
     35      * 配置servlet处理
     36      */
     @Override
     public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
                configurer.enable();
            }
}
